<template>
    <div class="home">
        <swiper></swiper>

<!--        广告-->
        <div id="bili_live" style="margin: 100px;">
            <a data-loc-id="40" target="_blank" class="banner-card b-wrap"
               href="https://wx.kaikeba.com/xiaoke/market/landing-page/v2/WljNB9qAS0LsNqrFvQO?channel=bilibili&track_id=kCjuz-qFlxrZQHvtin8MLcYjZ0XaNfYkjefqNF6jI2lUtkbSePd4kPxLOjS_foKQiGa77d8MLlFFaH78cLk9bpahi2b7gOJAkGSV_PJ3btRusOSY-bEvsX_82gUh5uQUq3x-fOLVLAw8z6yqAXcPaJVDEs8fUaRQIEnJQUJGhEX6XYGWu_nH2WOQG_knrG8y" >
                <img src="https://i0.hdslb.com/bfs/sycp/creative_img/202107/877672629aeb1d7a91a81b4b8df0736e.jpg" alt
                width="100%"
                >
                <i class="gg-icon"></i>
            </a>
        </div>


        <div class="section" v-for="(item,index) in videoList"  :key="index">
            <div class="section-title">{{item.name}}

            </div>
            <el-row>
                <el-col :span="24">
                    <el-card :body-style="{ padding: '0px'} " class="card">
                        <img :src="item.logo" class="image">
                        <div style="padding: 14px;">

<!--                            <span>{{videoname}}</span>-->
                            <div class="bottom clearfix">
                                <P>{{item.info}}</P>
                                <p>{{content}}</p>

                                <time class="time">{{ item.addtime}}</time>
                                <el-button type="text" class="button" @click="goplay(item.url,item.videoid)">
                                    播放
                                </el-button>
                            </div>
                        </div>
                    </el-card>
                </el-col>
            </el-row>


<!--           <content-list :contentList="item.list"></content-list>-->
        </div>
    </div>
</template>

<script>

import Swiper from "../components/Swiper";
// import contentList from "../components/ContentList"
import {getAllVideoList,setCollect,findByVideoid} from "../api";
import {mapGetters} from 'vuex'
    import video from "../store/video";

export default {
        name: "home",
        components:{
            Swiper,
           // contentList
        },
    data(){
            return{
                currentDate: new Date(),
                videoList:[],
                videourl:'',
                content:'',


                // arrname:[]
            }
    },

    created() {
            this.getAllVideoList()
    },
    methods:{
        //提示信息
        notify(title,type){
            this.$notify({
                title:title,
                type:type
            })
        },
        getAllVideoList(){  //获取前条视频
                getAllVideoList().then((res)=>{
                    this.videoList=res.data.videolist;
                  //  this.videoId=res.data.videolist.videoid;
                    //console.log(res.data.videolist)
                }).catch((err)=>{
                    console.log(err)
                })
            findByVideoid(1).then((res)=>{
                this.content=res.data.adverts[0].content
               // console.log(res.data.adverts[0].content)

            })
        },
        goplay(url,videoId){

            this.$router.push({path:'/play',query:{videourl: url,videoid:videoId}
            })
        },

    }
    }
</script>

<style lang="scss" scoped>
@import "../assets/css/home.scss";


.time {
    font-size: 13px;
    color: #999;
}

.bottom {
    margin-top: 13px;
    line-height: 12px;
}
.card{
    width: 100%;
}
.button {
    padding: 0;
    float: right;
}

.image {
    width: 100%;
    display: block;
}

.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both
}
</style>